package test_suite;

import static org.junit.Assert.*;

import org.junit.Test;

import queenProblem.QueenProblemSolver;

public class QueenProblemSolverTest {

	@Test
	public void testIsSetableQueen() {
		
		boolean[][] pf = new boolean[5][5]; // all false
		pf[2][1]=true;
		QueenProblemSolver qps = new QueenProblemSolver(pf, 0);
		assertTrue(qps.isQueenSettable(4, 4));
		
		assertFalse(qps.isQueenSettable(2, 1));
		assertFalse(qps.isQueenSettable(2, 2));
		assertFalse(qps.isQueenSettable(2, 0));
		assertFalse(qps.isQueenSettable(1, 1));
		assertFalse(qps.isQueenSettable(3, 1));
		
		assertFalse(qps.isQueenSettable(1, 0));
		assertFalse(qps.isQueenSettable(3,0 ));
		assertFalse(qps.isQueenSettable(1, 2));
		assertFalse(qps.isQueenSettable(3, 2));
		
	}
	
	@Test(expected=RuntimeException.class)
	public void testIllegalPlayField1() {
		new QueenProblemSolver(null, -1);
	}
	
	@Test(expected=RuntimeException.class)
	public void testIllegalPlayField2() {
		boolean[][] pf = new boolean[0][0];
		new QueenProblemSolver(pf, 50);
	}
	
	@Test(expected=RuntimeException.class)
	public void testIllegalPlayField3() {
		boolean[][] pf = new boolean[2][-1];
		new QueenProblemSolver(pf, 50);
	}
	
	@Test(expected=RuntimeException.class)
	public void testIllegalPlayField4() {
		boolean[][] pf = new boolean[2][1];
		new QueenProblemSolver(pf, 50);
	}

}
